gdk: Replace 'WITHDRAWN' state with async 'is-mapped' boolean
authorJonas Ådahl <jadahl@gmail.com>
Mon, 7 Dec 2020 17:18:38 +0000 (18:18 +0100)
committerJonas Ådahl <jadahl@gmail.com>
Mon, 7 Dec 2020 19:37:30 +0000 (20:37 +0100)
commitd2c95a1b13ee710fcfc69a592be669bcea4b26e8
tree0b94b1569acc71d4c4196f2fc85a7b44b65e91b6
parent8f8c5040dbfc9fe1bac0df7664c39f65c3110428
gdk: Replace 'WITHDRAWN' state with async 'is-mapped' boolean

It was used by all surfaces to track 'is-mapped', but still part of the
GdkToplevelState, and is now replaced with a separate boolean in the
GdkSurface structure.

It also caused issues when a widget was unmapped, and due to that
unmapped a popover which hid its corresponding surface. When this
surface was hidden, it emitted a state change event, which would then go
back into GTK and queue a resize on popover widget, which would travel
back down to the widget that was originally unmapped, causing confusino
when doing future allocations.

To summarize, one should not hide widgets during allocation, and to
avoid this, make this new is-mapped boolean asynchronous when hiding a
surface, meaning the notification event for the changed mapped state
will be emitted in an idle callback. This avoids the above described
reentry issue.
17 files changed:
gdk/broadway/gdksurface-broadway.c
gdk/gdksurface.c
gdk/gdksurfaceprivate.h
gdk/gdktoplevel.c
gdk/gdktoplevel.h
gdk/macos/gdkmacossurface.c
gdk/wayland/gdksurface-wayland.c
gdk/win32/gdkevents-win32.c
gdk/win32/gdkmain-win32.c
gdk/win32/gdksurface-win32.c
gdk/x11/gdkdisplay-x11.c
gdk/x11/gdkdrag-x11.c
gdk/x11/gdkglcontext-x11.c
gdk/x11/gdksurface-x11.c
gtk/gtktooltipwindow.c
gtk/gtkwindow.c
tests/testgtk.c